package com.handbook;



import java.util.concurrent.locks.ReentrantLock;

public class thread {
    static final ReentrantLock lock = new ReentrantLock();

    public static final ThreadLocal<String> session = new ThreadLocal<String>();
    public static void main(String[] args) {
        String s = "abc";
        String s1 = new String("abc") ;
        String s2 = new String("abc") ;
        if( s == s2 ){ //不会执行的语句}
            System.out.println("在堆中创建了一个对象");

        }
        else{
            System.out.println("在堆中创建了两个对象");
        }

    }

    public static String get(int i ){
        if (i ==1) {
            synchronized ("sdf") {
                System.out.println("sdf");
            }
        }

        return "sdf";
    }
}
